package com.niiwoo.civet.user.service.local;

import com.niiwoo.civet.user.dao.entity.FacePlusPortrait;
import com.niiwoo.civet.user.dao.entity.UserImageFile;
import com.niiwoo.civet.user.dao.mapper.FacePlusPortraitMapper;
import com.niiwoo.civet.user.dao.mapper.IdentityInfoMapperExt;
import com.niiwoo.civet.user.dao.mapper.UserImageFileMapperExt;
import com.niiwoo.civet.user.enums.UserImgTypeEnum;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户图片本地服务
 */
@Service
public class UserImageFileService {

    @Autowired
    UserImageFileMapperExt userImageFileMapper;
    @Autowired
    FacePlusPortraitMapper facePlusPortraitMapper;

    /**
     * 根据类型获取图片列表
     *
     * @param userId 用户ID
     * @param type 类型
     */
    public List<UserImageFile> getListByType(String userId, UserImgTypeEnum type) {
        return userImageFileMapper.selectByType(userId, type.getValue());
    }

    /**
     * 根据类型获取图片
     *
     * @param userId 用户ID
     * @param subType 自类型
     */
    public UserImageFile getByType(String userId, UserImgTypeEnum type, UserImgTypeEnum subType) {
        return userImageFileMapper.selectBySubType(userId, type.getValue(), subType.getValue());
    }

    public FacePlusPortrait queryFacePortrait(String userId) {
        return facePlusPortraitMapper.selectByPrimaryKey(userId);
    }

}
